﻿using System.Collections.Generic;
using System.Data;
using Unis.Framework.RuleBase.Common;
using KingRoad.EPM.CompletionMaterialsEntity.Model;
using System;

namespace KingRoad.EPM.CompletionMaterialsDAL.BcdProjectFileService
{    
    /// <summary> 
    /// 文件生成时间 2017/1/12 11:36:11
    /// </summary> 
    public class BcdProjectfileService : BaseService<BcdProjectfileInfo>, IBcdProjectfileService
    {
        public int DeleteEntity(BcdProjectfileInfo info)
        {
            string _modelMapXmlName = "BcdProjectfile";
            int ret = DatabaseExcuteByXmlHelper.NewInstance.ExecuteNonQuery(_modelMapXmlName, "DeleteObject",info.P_ID, info.Fd_ID);
            return ret;
        }
        /// <summary>
        /// 根据项目id，文档类型id 获取该项目下此文档类型的子类型个数
        /// </summary>
        /// <param name="P_ID">项目id</param>
        /// <param name="Fd_ID">文档类型id</param>
        /// <returns></returns>
        public int GetCountByPIDAndFdID(string P_ID, string Fd_ID)
        {
            string strSql = "select Count(Fd_ID) as numb from V_Bcd_ProjectFile where  P_ID='" + P_ID + "' and Fd_PID='" + Fd_ID + "' ";
            DataTable dt = DatabaseExcuteBySql.QuerybySql(strSql);
            return Convert.ToInt32(dt.Rows[0][0]);
        }
    }

}
